package com.etop.service;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.etop.dao.FunctionDao;
import com.etop.pojo.Function;

/**
 * @类名:FunctionService 网页过滤服务，与dao进行对接
 * @author Administrator
 *
 */
@SuppressWarnings("serial")
@Service("FunctionService")
public class FunctionService implements Serializable {
   
	@Autowired
	private FunctionDao functionDao;
	/**
	 * 查找所有权限过滤信息
	 */
	public List<Function>findAll(){
		return functionDao.find("from Function f");
	}
	public void saveFunction(Function function){
		functionDao.saveOrUpdate(function);
	}
	public Function findFunctionById(int id){
		Map<String,Object> params=new HashMap<String,Object>();
		params.put("id", id);
		return (Function) functionDao.findUniqueResult("from Function f where id=:id", params);
	}
	public void updateFunction(Function function){
		functionDao.saveOrUpdate(function);
	}
	public void deleteFunction(int id){
		functionDao.deleteById(id);
	}
}
